<template>
  <div class="home">
    <h2>{{message | currency("¥",2)}}</h2>
    <h2 ref="hhh" class="hhh">{{msg.message}}</h2>
    <div @click="riseChild">{{isRight}}</div>
    <hr>
    <item :homeData="msg" @increment="incrementTotal" ref="child"></item>
  </div>
</template>
<script>
import item from './homeItem.vue'
export default {
  created() {},
  components: {
    item
  },
  data() {
    return {
      msg: {
        message: '我是父组件的数据'
      },
      message: 66666,
      isRight: false,
      show: true
    }
  },
  methods: {
    incrementTotal() {
      this.isRight = !this.isRight
    },
    riseChild() {
      var child = this.$refs.child; //获取子组件实例
      child.add(); //调用子组件方法 add
    }
  },
  activated() { //缓存页面显示时调用
    console.log(789)
  },
  deactivated() { //缓存页面销毁时调用

  },
  mounted() {
    // this.$ajax({
    //      method: 'post',
    //      url: '/user',
    //      data: {
    //        name: 'wise',
    //        info: 'wrong'
    //      }
    //   })
    // console.log(this.$refs.hhh.className)

  }
}

</script>
<style lang="less">
.home {
  border: 1px solid #000;
}

</style>

